package com.lut.demo4;

import com.lut.demo2.UserService;
import com.lut.demo2.UserServiceImpl;

/**
 * @author liuning
 * @ProjectName GOF23
 * @time 2021/12/24 15:26
 */
public class Client {
    public static void main(String[] args) {
        //真实角色
        UserServiceImpl userService = new UserServiceImpl();
        //代理角色，不存在
        ProxyInvocationHandler pih = new ProxyInvocationHandler();

        pih.setTarget(userService);//设置代理的对象
        //动态生成代理类
        UserService proxy = (UserService) pih.getProxy();
        proxy.add();
    }
}
